#pragma once
#include <coroutine>
#include <chrono>
namespace nco
{

    class Sleep
    {
    public:
        Sleep(int64_t ms);
        Sleep(const std::chrono::seconds &second);
        Sleep(const std::chrono::milliseconds &ms);
        bool await_ready() const;
        void await_resume();
        void await_suspend(std::coroutine_handle<> handle);

    private:
        int64_t m_waitUntil;
    };

    class SleepScheduler
    {
    public:
        void operator()();

    private:
        friend Sleep;
        static void add_Co(clock_t ct, const std::coroutine_handle<> &handle);
    };
}